<?php
/**
 * Magento Enterprise Edition
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Magento Enterprise Edition End User License Agreement
 * that is bundled with this package in the file LICENSE_EE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.magento.com/license/enterprise-edition
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magento.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magento.com for more information.
 *
 * @category    design
 * @package     rwd_enterprise
 * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
 * @license http://www.magento.com/license/enterprise-edition
 */
?>
<?php
/**
 * @see Enterprise_GiftCardAccount_Block_Checkout_Cart_Giftcardaccount
 */
?>
<div class="giftcard">
    <h2><?php echo $this->__('Gift Cards') ?></h2>
    <div id="giftcard_balance_lookup"></div>
    <span id="gc-please-wait" class="please-wait" style="display:none;">
        <img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="" class="v-middle" /> <?php echo $this->__('Please wait, loading...') ?>
    </span>
    <form id="giftcard-form" action="<?php echo $this->getAddCartActionUrl(); ?>" method="post">
        <label for="giftcard_code"><?php echo $this->__('Gift Cards') ?></label>
        <div class="field-wrapper">
            <input class="required-entry input-text" type="text" id="giftcard_code" name="giftcard_code" value="" />
            <div class="button-wrapper">
                <button class="button2" onclick="giftcardForm.submit()" type="button" value="<?php echo $this->__('Apply') ?>"><span><span><?php echo $this->__('Apply') ?></span></span></button>
            </div>
        </div>
        <a class="button2 check-gc-status" onclick="checkGiftCardStatus();" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Check Gift Card status and balance')) ?>"><span><span><?php echo $this->__('Check Gift Card status and balance') ?></span></span></a>
    </form>

    <script type="text/javascript">
    //<![CDATA[
    var giftcardForm = new VarienForm('giftcard-form');
    function checkGiftCardStatus()
    {
        if (giftcardForm.validator && !giftcardForm.validator.validate()) {
            return false;
        }
        new Ajax.Updater(
            'giftcard_balance_lookup',
            '<?php echo Mage::getUrl('enterprise_giftcardaccount/cart/quickCheck') ?>',
            {
                onCreate: function() { $('gc-please-wait').show(); },
                onComplete: function() { $('gc-please-wait').hide(); },
                parameters : {giftcard_code : $('giftcard_code').value}
            }
        );
    }
    //]]>
    </script>
</div>
